#ifndef _MY_WIFI_H
#define _MY_WIFI_H

#include "esp_wifi.h"
#include <stdlib.h>

#define EXAMPLE_ESP_MAXIMUM_RETRY 3

#define WIFI_CONNECTED_BIT BIT0
#define WIFI_FAIL_BIT BIT1

#define CONN_OK 0
#define CONN_FAIL 1
#define CONN_NONE 2
#define CONN_BOTH 3
#define CONN_ELTH 4

// wifi ssid pswd len  不能超过32和64
#define SSID_LEN 32
#define PSWD_LEN 64

void modify_wificonfig_ssid(const char *pswd);
void modify_wificonfig_pswd(const char *pswd);

esp_err_t store_wificonfig_to_nvs(void);
esp_err_t set_wifi_config_from_nvs(void);

uint8_t wifi_init(void);
void start_sta_wifi(void);
uint8_t get_wifi_status(void);
void reset_wifi(void);
uint8_t app_wifi_wait_connected(void);

#endif